Post

Replies

Boosts

Views

Activity

Getting the Locale of the System in iOS
Hi, I use the elbow code to toggle between English and Arabic locale, but the alert message always shows en_QA which is English I guess even when locale changed to Arabic ? why is that ? struct arview: View { @Environment(\.locale) private var locale @State private var showingAlert = false @State private var isLTR: Bool = false @State private var txtValue = "" var body: some View { VStack{ Text("Note Title") TextField("Place Holder", text: $txtValue) Button("Change Locale") { isLTR.toggle() } Button("Show Alert") { showingAlert = true } .alert("Current Locale: \(locale.identifier)", isPresented: $showingAlert) { Button("OK", role: .cancel) { } } } .padding() .environment (\.locale, isLTR ? Locale.init(identifier: "en" ) : Locale.init(identifier: "ar" )) } }
0
0
376
Jan ’24
Views Autopsy in SwiftUI
Hi, How to see a views Autopsy in SwiftUI specially when views stacks together and over each other, like to see what area they occupy how they overlap understand why white space is here and there ? Maybe there's a tool or plug in ? I remember layers in UIKit, had such tool and feature in Xcode. Kindest Regards
0
0
391
Feb ’24